--判断是否在schema存在该表，sysobjects是全局的，根据sysuers的uid去判断
IF EXISTS(SELECT 1 FROM sysobjects a,sysusers b WHERE  a.uid= b.uid and a.name = ${tableName} and b.name=${schema})
BEGIN
--如果表存在则删除表
DROP TABLE${schema}.${tableName}
end
go

CREATE TABLE ${schema}.${tableName}(
<#list columnList as column>
    <#if column_has_next>
        ${column.columnFullInfo}<#if column.isNullable==false> NOT NULL </#if>,
    <#else>
        ${column.columnFullInfo}<#if column.isNullable==false> NOT NULL </#if>
    </#if>
</#list>
<#if primaykeyList ??>
    PRIMARY KEY (
    <#list primayKeyList as primayKey>
        <#if primayKey_has_next>
            ${primayKey},
        <#else>
            ${primayKey}
        </#if>
    </#list>
    )
</#if>
)
GO